#include <stdio.h>
#include "lex.h"
FILE *fin;
extern int token;
extern int line_num;

int main(int argc, char **argv)
{
    fin = fopen(argv[1], "rb");
    if (!fin)
    {
        printf("不能打开SC源文件!\n");
        return 0;
    }
    init();
    getch();
    do
    {
        get_token();
        color_token(LEX_NORMAL);
    } while (token != TK_EOF);
    printf("\n代码行数:%d行\n", line_num);
    cleanup();
    fclose(fin);
    printf("%s词法分析完成!\n", argv[1]);
    return 1;
}